package com.lanhai.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 工序
 * @author liangmin
 *
 */
public enum Step {
	ZRS(1, "制绒上料"),
	ZRX(2, "制绒下料"),
	KSX(3, "扩散下料"),
	SE(4, "SE"),
	QY(5, "前氧"),
	JPS(6, "碱抛上"),
	JPX(7, "碱抛下"),
	HYS(8, "后氧上"),
	JPFK(9, "碱抛返空篮"),
	KSS(10, "扩散上料"),
	HYX(11, "后氧下料"),
	ALD(12,"ALD上料"),
	PEB(13,"PE背膜"),
	PEZ(14,"PE正膜"),
	SW(15,"丝网"),
	ALDX(16,"ALD下料"),
	PEBX(17,"PE背膜下料"),
	PEZX(18,"PE正膜下料");	
	
	private Step(Integer code, String name){
		this.code = code;
		this.name = name;
	}
	
	private Integer code;
	private String name;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
    public static String getValueByCode(Integer code){
        for(Step step:Step.values()){
            if(code == step.getCode()){
                return step.getName();
            }
        }
        return  null;
    }

    public static List<Map<String, Object>> getList(){
    	List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
    	for(Step step:Step.values()){
    		Map<String, Object> map = new HashMap<String, Object>();
    		map.put("key", step.getCode());
    		map.put("name", step.getName());
    		list.add(map);
    	}
    	return list;
    }
    
    public static Step getStepByCode(Integer code){
    	Step step = null;
    	switch (code) {
    	case 1:
    		step = Step.ZRS;
    		break;  
    	case 2:
    		step = Step.ZRX;
    		break;    		
    	case 3:
    		step = Step.KSX;
    		break;    		
    	case 4:
    		step = Step.SE;
    		break;  
    	case 5:
    		step = Step.QY;
    		break;      		
    	case 6:
    		step = Step.JPS;
    		break;  
    	case 7:
    		step = Step.JPX;
    		break;
    	case 8:
    		step = Step.HYS;
    		break;      		
    	case 9:
    		step = Step.JPFK;
    		break; 
    	case 10:
    		step = Step.KSS;
    		break;
    	case 11:
    		step = Step.HYX;
    		break;
    	case 12:
    		step = Step.ALD;
    		break;
    	case 13:
    		step = Step.PEB;
    		break;
    	case 14:
    		step = Step.PEZ;
    		break;
    	case 15:
    		step = Step.SW;
    		break;
    	case 16:
    		step = Step.ALDX;
    		break;
    	case 17:
    		step = Step.PEBX;
    		break;
    	case 18:
    		step = Step.PEZX;
    		break;
    	}
    	return step;
    }
    
}
